<include file="public@header"/>
</head>
<style>
    td input,td select{ width:auto; max-width:180px;}
    .form-horizontal .control-group1 {
        float: left;
        width: 15%;
        margin-bottom: 20px;
    }
    .form-horizontal .control-label {width:80px;}
    .form-horizontal .controls {margin-left:90px;}
    input,select, textarea, .uneditable-input {
        max-width: 580px;
        width:100px;
        min-width:auto;
    }

</style>
<body>
<php>$page='3';$vo['id']='';</php>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li class="active"><a href="{:url('Aftersale/carve')}">业务受理</a></li>
    </ul>
    <form  class="form-horizontal js-ajax-form" method="post" action="{:url('Aftersale/carve')}">
        <!--改版画面-->
        <div class="div_title"><span>客户概览</span></div>
        <div class="control-group1-p div_content">
            <fieldset>
                <div class="control-group1">
                    <label class="control-label">客户姓名</label>
                    <div class="controls">
                        <input type="text" class="form-control" value="{$result.buyer_name}" disabled>
                    </div>
                </div>
                <div class="control-group1">
                    <label class="control-label">持证类型</label>
                    <div class="controls">
                        <input type="text" class="form-control" value="{:cart_type('cart',$result.cart_type)}" disabled>
                    </div>
                </div>
                <div class="control-group1">
                    <label class="control-label">证件号码</label>
                    <div class="controls">
                        <input type="text" class="form-control" style="width:150px;" value="{$result.customer_account}" disabled>
                    </div>
                </div>
                <div class="control-group1">
                    <label class="control-label">联系电话</label>
                    <div class="controls">
                        <input type="text" class="form-control" value="{$result.buyer_phone}" disabled>
                    </div>
                </div>
                <div class="control-group1" style="width:40%;">
                    <label class="control-label">联系地址</label>
                    <div class="controls">
                        <input type="text" class="form-control" value="{$result.customer_address}" style="width:80%;" disabled>
                    </div>
                </div>
                <div class="control-group1">
                    <label class="control-label">合同编号</label>
                    <div class="controls">
                        <input type="text" class="form-control" value="{$result.contract_sn}" disabled>
                    </div>
                </div>
                <div class="control-group1">
                    <label class="control-label">购买日期</label>
                    <div class="controls">
                        <input type="text" class="form-control" value="{$result.gm_start_time}" disabled>
                    </div>
                </div>
                <div class="control-group1">
                    <label class="control-label">打证日期</label>
                    <div class="controls">
                        <input type="text" class="form-control" value="{$result.dz_start_time}" disabled>
                    </div>
                </div>
                <div class="control-group1">
                    <label class="control-label">保修状态</label>
                    <div class="controls">
                        <input type="text" class="form-control" value="{$result.end_bxq_time}" disabled>
                    </div>
                </div>
                <div class="control-group1">
                    <label class="control-label">当前状态</label>
                    <div class="controls">
                        <input type="text" class="form-control" value="{$result.col_status_name}" disabled>
                    </div>
                </div>
                <div class="control-group1">
                    <label class="control-label">维护期</label>
                    <div class="controls">
                        <input type="text" class="form-control" value="{$result.whq_status}" disabled>
                    </div>
                </div>
                <div class="control-group1">
                    <label class="control-label">墓位编号</label>
                    <div class="controls">
                        <input type="text" class="form-control" value="{$result.tomb_num}" disabled>
                    </div>
                </div>
                <div class="control-group1">
                    <label class="control-label">具体位置</label>
                    <div class="controls">
                        <input type="text" class="form-control" value="{$result.tomb_region}{$result.tomb_address}" disabled>
                    </div>
                </div>
                <div class="control-group1">
                    <label class="control-label">墓穴规制</label>
                    <div class="controls">
                        <input type="text" class="form-control" value="{$result.tomb_regulation_name}" disabled>
                    </div>
                </div>
                <div class="control-group1" style="width:20%;">
                    <label class="control-label" style="width:140px;">单个内穴最大尺寸</label>
                    <div class="controls" style="margin-left:150px;">
                        <input type="text" class="form-control" value="400mm*400mm*400mm" disabled>
                    </div>
                </div>
            </fieldset>
            <!---tab页-->
            <ul class="nav_tabs">
                <li class="active"><a href="javascript:">碑文瓷像</a></li>
                <li><a href="javascript:">历史记录</a></li>
            </ul>
            <div class="control-group1-p nav_content">
                <div class="content_nav">
                    <form action="{:url('stonepost/carve')}" method="post">
                        <div class="p_title">
                            <span class="span_title">选项登记</span>
                        </div>
                        <div class="control-group1-p" style="border:1px solid #e2e2e2; padding-top:20px;margin:0 20px;overflow:hidden; overflow-x:auto;">
                            <div class="control-group1" style="width:20%;">
                                <label class="control-label" style="width:140px;">墓碑：</label>
                                <div class="controls" style="margin-left:150px;">
                                    <select name="data[mb_id]" class="form-control">
                                        <foreach name="tomb_list" item="vo">
                                            <option value="{$vo.id}"  >{$vo.pro_name}</option>
                                        </foreach>
                                    </select>
                                </div>
                            </div>



                            <table class="table table-hover table-bordered">
                                <tbody>
                                <tr>
                                    <td>
                                        <div class="checkbox">
                                            <label>
                                                <input type="checkbox" name="data[type][]" <if condition=" in_array('insc',explode(',',$data['type']))"> checked </if> value="insc" id="input-mobile_tpl_enabled">碑文制作</label>
                                        </div>
                                    </td>
                                    <td>
                                        <select name="insc[type]" class="form-control">
                                            <option value="">选择碑文状态</option>
                                            <option value="1"<if condition=" $insc['type'] eq 1"> selected </if>>首刻</option>
                                            <option value="2"<if condition=" $insc['type'] eq 2"> selected </if>>补刻</option>
                                            <option value="3"<if condition=" $insc['type'] eq 3"> selected </if>>重刻</option>
                                        </select>
                                    </td>
                                    <td><input type="text" class="form-control" name="insc[engraving]" placeholder="碑文刻版" disabled></td>
                                    <td>
                                        <php>$img_url=cmf_get_image_preview_url(isset($insc['cart_upload'])?$insc['cart_upload']:'');</php>
                                        <input type="hidden" name="insc[cart_upload_id]" id="cart_upload-file_id" value="{$insc.cart_upload_id|default=''}">
                                        <input type="hidden" name="insc[cart_upload]" id="cart_upload" value="{$insc.cart_upload|default=''}">
                                        <a href="javascript:gpyUploadOneImage('上传签章碑文单', '#cart_upload','{$result.tomb_num}');">
                                            <h5 class="btn btn-primary">上传签章碑文单</h5>
                                        </a>
                                        <img style="cursor: pointer; height: 50px" onclick="parent.imagePreviewDialog(this.src);" src="{$img_url}" class="preview" id="cart_upload-preview" />
                                    </td>
                                    <td>
                                        <div class="checkbox">
                                            <label><input type="checkbox" name="insc[position][]" value="1" <if condition=" in_array('1',explode(',',$insc['position']))"> checked </if>>碑版正面刻字</label>
                                            <label><input type="checkbox" name="insc[position][]" value="2" <if condition=" in_array('2',explode(',',$insc['position']))"> checked </if>>碑版背面刻字</label>
                                            <label><input type="checkbox" name="insc[position][]" value="3" <if condition=" in_array('3',explode(',',$insc['position']))"> checked </if>>盖板刻字</label>
                                            <label><input type="checkbox" name="insc[position][]" value="4" <if condition=" in_array('4',explode(',',$insc['position']))"> checked </if>>局部刻字</label>
                                        </div>
                                    </td>
                                    <td><input type="text" class="form-control js-date" name="insc[pay_time]" value="{$insc.pay_time|default=''}" autocomplete="off" placeholder="交付时间"></td>
                                    <td><input type="text" class="form-control price_change" name="insc[price]" value="{$insc.price|default=''}" placeholder="价格"></td>
                                </tr>
                                <!--第二排-->
                                <tr>
                                    <td>
                                        <div class="checkbox">
                                            <label><input type="checkbox" name="data[type][]" value="gold" <if condition=" in_array('gold',explode(',',$data['type']))"> checked </if>> 字体贴金</label>
                                        </div>
                                    </td>
                                    <td colspan="2">
                                        <select name="gold[type]" class="form-control">
                                            <option value="1"<if condition=" $gold['type'] eq 1"> selected </if>>字体贴金</option>
                                            <option value="2"<if condition=" $gold['type'] eq 1"> selected </if>>描金漆</option>
                                        </select>
                                    </td>
                                    <td><input type="text" class="form-control" name="gold[unitprice]" value="{$gold.unitprice|default=''}" placeholder="单价">

                                        <select name="gold[unit]" class="form-control">
                                            <option value="1"<if condition=" $gold['unit'] eq 1"> selected </if>>平方米</option>
                                            <option value="2"<if condition=" $gold['unit'] eq 1"> selected </if>>套</option>
                                        </select>
                                    </td>
                                    <td><input type="text" class="form-control" name="gold[total]" value="{$gold.total|default=''}" placeholder="合计"></td>
                                    <td><input type="text" class="form-control js-date" name="gold[pay_time]" value="{$gold.pay_time|default=''}" autocomplete="off" placeholder="交付时间"></td>
                                    <td><input type="text" class="form-control price_change" name="gold[price]" value="{$gold.price|default=''}" placeholder="价格"></td>
                                </tr>
                                <!--第三排-->
                                <tr>
                                    <td>
                                        <div class="checkbox">
                                            <label><input type="checkbox" name="data[type][]" value="image" <if condition=" in_array('image',explode(',',$data['type']))"> checked </if>> 瓷像制作</label>
                                        </div>
                                    </td>
                                    <td>
                                        <select name="image[shape]" class="form-control">
                                            <option value="">请选择形状</option>
                                            <option value="1"<if condition=" $image['shape'] eq 1"> selected </if>>矩形</option>
                                            <option value="2"<if condition=" $image['shape'] eq 2"> selected </if>>椭圆形</option>
                                        </select>
                                    </td>
                                    <td>
                                        <select name="image[specificat]" class="form-control">
                                            <option value="">请选择规格</option>
                                            <option value="3" <if condition=" $image['specificat'] eq 3"> selected </if>>3吋</option>
                                            <option value="4" <if condition=" $image['specificat'] eq 4"> selected </if>>4吋</option>
                                            <option value="5" <if condition=" $image['specificat'] eq 5"> selected </if>>5吋</option>
                                            <option value="6" <if condition=" $image['specificat'] eq 6"> selected </if>>6吋</option>
                                            <option value="7" <if condition=" $image['specificat'] eq 7"> selected </if>>7吋</option>
                                            <option value="8" <if condition=" $image['specificat'] eq 8"> selected </if>>8吋</option>
                                            <option value="9" <if condition=" $image['specificat'] eq 9"> selected </if>>9吋</option>
                                            <option value="10" <if condition=" $image['specificat'] eq 10"> selected </if>>10吋</option>
                                            <option value="11" <if condition=" $image['specificat'] eq 11"> selected </if>>11吋</option>
                                            <option value="12" <if condition=" $image['specificat'] eq 12"> selected </if>>12吋</option>
                                            <option value="13" <if condition=" $image['specificat'] eq 13"> selected </if>>13吋</option>
                                            <option value="14" <if condition=" $image['specificat'] eq 14"> selected </if>>14吋</option>
                                            <option value="15" <if condition=" $image['specificat'] eq 15"> selected </if>>15吋</option>
                                            <option value="16" <if condition=" $image['specificat'] eq 16"> selected </if>>16吋</option>
                                            <option value="17" <if condition=" $image['specificat'] eq 17"> selected </if>>17吋</option>
                                            <option value="18" <if condition=" $image['specificat'] eq 18"> selected </if>>18吋</option>
                                        </select>
                                    </td>
                                    <td colspan="2">
                                        <php>$img_urls=cmf_get_image_preview_url(isset($image['cart_file'])?$image['cart_file']:'');</php>
                                        <input type="hidden" name="image[cart_file_id]" id="cart_file-file_id" value="{$image.cart_file_id|default=''}">
                                        <input type="hidden" name="image[cart_file]" id="cart_file" value="{$image.cart_file|default=''}">
                                        <a href="javascript:gpyUploadOneImage('上传签章照片', '#cart_file','{$result.tomb_num}');">
                                            <h5 class="btn btn-primary">上传签章照片</h5>
                                        </a>
                                        <img style="cursor: pointer; height: 50px" onclick="parent.imagePreviewDialog(this.src);" src="{$img_urls}" class="preview" id="cart_file-preview" />
                                    </td>
                                    <td><input type="text" class="form-control js-date" name="image[pay_time]" autocomplete="off" value="{$image.pay_time|default=''}" placeholder="交付时间"></td>
                                    <td><input type="text" class="form-control price_change" name="image[price]" value="{$image.price|default=''}" placeholder="价格"></td>
                                </tr>
                                <tr>
                                    <td colspan="7" style="text-align: right">
                                        价格合并： <input type="text" class="form-control" name="data[sumprice]" id="file_id" value="{$data.sumprice|default=''}">
                                    </td>
                                </tr>
                                </tbody>
                            </table>
                        </div >
                        <div class="form-actions">
                            <button type="submit" class="quan btn btn-primary js-ajax-submit">提交</button>
                        </div>
                    </form>
                </div>
                <div class="content_nav feature">
                    <div class="p_title">
                        <span class="span_title">历史记录</span>
                    </div>
                    <div class="control-group1-p" style="border:1px solid #e2e2e2; padding-top:20px;margin:0 20px;overflow:hidden; overflow-x:auto;">
                        <form action="{:url('Rock/order')}" method="post">

                                <foreach name="result_carve" item="vo_carve">
                                    <label style="margin-left: 18px;color: #75aad8;font-size: 17px;">记录提交时间：<php>echo date('Y-m-d H:i', $vo_carve['add_time'])</php></label>
                                    <table class="table table-hover table-bordered">
                                        <notempty name="vo_carve.insc_list">
                                            <thead >
                                                <tr>
                                                    <th>类型</th>
                                                    <th>碑文状态</th>
                                                    <th>碑文刻版</th>
                                                    <th>签章碑文单</th>
                                                    <th>项目</th>
                                                    <th>交付日期</th>
                                                    <th>价格</th>
                                                </tr>
                                            </thead>
                                            <tbody>
                                                <foreach name="vo_carve.insc_list" item="vo">
                                                <tr>
                                                    <td>碑文制作</td>
                                                    <td><if ($vo.type)==1>首刻 <elseif ($vo.type)==2/> 补刻 <elseif ($vo.type)==3/> 重刻</if> </td>
                                                    <td>{$vo.engraving}</td>
                                                    <php>$img_url=cmf_get_image_preview_url(isset($vo['cart_upload'])?$vo['cart_upload']:'');</php>
                                                    <td><img style="cursor: hand; height: 50px" onclick="parent.imagePreviewDialog(this.src);" src="{$img_url}" class="preview"/></td>
                                                    <td><if ($vo.position)==1>正面 <elseif ($vo.position)==2/> 背面 <elseif ($vo.position)==3/> 盖板 <elseif ($vo.position)==4/> 局部 </if></td>
                                                    <td><php>echo date('Y-m-d', $vo['pay_time'])</php></td>
                                                    <td>{$vo.price}</td>
                                                </tr>
                                            </foreach>
                                            </tbody>
                                        </notempty>
                                        <notempty name="vo_carve.gold_list">
                                            <thead>
                                            <tr>
                                                <th>类型</th>
                                                <th colspan="2">项目</th>
                                                <th>单价</th>
                                                <th>合计</th>
                                                <th>交付日期</th>
                                                <th>价格</th>
                                            </tr>
                                            </thead>
                                            <tbody>
                                            <foreach name="vo_carve.gold_list" item="vo">
                                                <tr>
                                                    <td>字体贴金</td>
                                                    <td colspan="2"><if ($vo.type)==1>字体贴金 <elseif ($vo.type)==2/> 描金漆</if> </td>
                                                    <td>{$vo.unitprice}</td>
                                                    <td>{$vo.total}</td>
                                                    <td><php >echo date('Y-m-d', $vo['pay_time'])</php></td>
                                                    <td>{$vo.price}</td>
                                                </tr>
                                            </foreach>
                                            </tbody>
                                        </notempty>
                                        <notempty name="vo_carve.image_list">
                                            <thead>
                                            <tr>
                                                <th>类型</th>
                                                <th>形状</th>
                                                <th>规格</th>
                                                <th colspan="2">签章照片</th>
                                                <th>交付日期</th>
                                                <th>价格</th>
                                            </tr>
                                            </thead>
                                            <tbody>
                                            <foreach name="vo_carve.image_list" item="vo">
                                                <tr>
                                                    <td>瓷像制作</td>
                                                    <td><if ($vo.shape)==1>矩形 <elseif ($vo.shape)==2/> 椭圆形</if> </td>
                                                    <td>{$vo.specificat}时</td>
                                                    <php>$img_url=cmf_get_image_preview_url(isset($vo['cart_file'])?$vo['cart_file']:'');</php>
                                                    <td colspan="2"><img style="cursor: pointer; height: 50px" onclick="parent.imagePreviewDialog(this.src);"  src="{$img_url}" class="preview"/></td>
                                                    <td><php >echo date('Y-m-d', $vo['pay_time'])</php></td>
                                                    <td>{$vo.price}</td>
                                                </tr>
                                            </foreach>
                                            </tbody>
                                        </notempty>
                                        <tr>
                                            <td colspan="7">
                                                <div>
                                                    <div class="btn btn-primary print" data-payId="{$vo_carve.pay_id}" id="" style="margin-left: 90%;"> 补打结算单</div>
                                                </div>
                                            </td>
                                        </tr>
                                    </table><br/>
                                </foreach>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </form>
</div>
<div id="result" style="display:none">
    <form class="form-horizontal">
        <div class="control-group1-p" style=" border:none;">
            <div class="control-group1" style="width:25%;">
                <label class="control-label" style="color:rgb(11, 126, 191)">状态</label>
                <div class="controls" >
                    <input type="text" class="form-control"  style="width:50px" value="已完成" disabled>
                </div>
            </div>
            <div class="control-group1" style="width:25%;">
                <label class="control-label" style="color:rgb(11, 126, 191)">反馈人</label>
                <div class="controls" >
                    <input type="text" class="form-control"  style="width:50px" value="" disabled>
                </div>
            </div>
            <div class="control-group1" style="width:25%;">
                <label class="control-label"style="color:rgb(11, 126, 191)"> 反馈时间</label>
                <div class="controls" >
                    <input type="text" class="form-control"  style="width:50px" value="" disabled>
                </div>
            </div>
            <div class="control-group1" style="width:100%;">
                <label class="control-label" ></label>
                <div class="controls" >
                    <textarea cols="8" style="width:80%; height:150px;"></textarea>
                </div>
            </div>
            <div class="control-group1" style="width:100%;">
                <label class="control-label" style="width:120px;color:rgb(11, 126, 191)">查看反馈图片</label>
                <div class="controls" >

                </div>
            </div>
            <div style="margin-left:90px;">
                <img src="__TMPL__Public/assets/images/1.png" style="width:150px; max-width:220px; float:left; padding:0 20px;"/>
                <img src="__TMPL__Public/assets/images/2.png" style="width:150px; max-width:220px; float:left; padding:0 20px;"/>
                <img src="__TMPL__Public/assets/images/3.png" style="width:150px; max-width:220px; float:left; padding:0 20px;"/>
            </div>
        </div>
    </form>
</div>

<div id="print_html" style="display: none"></div>
<script type="text/javascript" src="__STATIC__/js/lodop/LodopFuncs.js?v={:time()}"></script>
<script type="text/javascript" src="__STATIC__/js/admin.js?1"></script>
<script type="text/javascript" src="__STATIC__/js/layer/layer.js"></script>
<script type="text/javascript" src="__STATIC__/js/print.js?1"></script>

<script type="text/javascript">

    //切换显示
    $(document).on('click','.nav_tabs li',function(){
        $(this).addClass('active').siblings().removeClass('active');
        var index = $(".nav_tabs li").index(this);
        billtype = index;
        console.log(index);
        $('.content_nav').eq(index).removeClass("feature").siblings().addClass("feature");
    });
    // 提交订单
    $("#check-btn").click(function(){
        $.post($("form").attr('action'), $("form").serialize(), function(result){
            if(result.state == 'success'){
                alert("保存成功！");
                $('#js-dialog-close').click();
            } else {
                alert(result.info);
            }
        }, 'json');
    });
    $('.print').on('click',function(){
        var payId = $(this).attr('data-payId');
        $.ajax({
            type: "get", url:"{:url('Print/print_cert')}?type=3&pay_id="+payId,
            success: function (strHtml) {
                console.log('打印')
                var data = strHtml.data;
                $('#print_html').html(data.html)
                preViewPrint('服务结算单',3,7)
            }
        })
    })

    // 删除使用人
    $(document).on("click","[name='del_user']",function(){
        $(this).parents("div[name='now_user']").remove();
    })
    $(document).on("change",".price_change",function(){

        var sumprice = 0;
        $(".price_change").each(function(){
            var v = $(this).val()?$(this).val():0;
            sumprice += parseFloat(v);
        });

        $("input[name='data[sumprice]']").val(sumprice);
    })

</script>

</body>
</html>